package com.kfm.pm;

public class Exec01 {
    public static void main(String[] args) {
        // 定义一个 5 * 5 的二维数组并初始化，找出数组中的最大值的坐标。
        int[][] arr = {
                {56, 6, 3, 7, 5},
                {34, 10, 5, 10, 4},
                {354, 435, 34, 23, 54},
                {325, 56, 98, 454, 3},
                {3, 5, 7, 6, 4},
        };
//        int[] nums = new int[5];   // 记录每一行的最大值
        int max = arr[0][0];
        int indexX = -1;
        int indexY = -1;
        for (int i = 0; i < arr.length; i++) {
            for (int j = 0; j < arr[i].length; j++) {
                if (max < arr[i][j]) {
                    max = arr[i][j];
                    indexX = i;
                    indexY = j;
                }
            }
        }

        System.out.println("最大值是：" + max);
        System.out.println("最大值坐标是：" + indexX + ", " + indexY);

    }
}
